package com.zhuoshi.serviceImpl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.zhuoshi.entity.Complex;
import com.zhuoshi.entity.ComplexCustom;
import com.zhuoshi.mapper.ComplexMapper;
import com.zhuoshi.service.ComplexService;

@Service("complexService")
@Transactional
public class ComplexServiceImpl implements ComplexService{
	
	@Autowired
	private ComplexMapper complexMapper;
	
	//查询全部的楼栋
	public List<Complex> selectAllComplexLiu() {
		return complexMapper.selectByExample(null);
	}
	
	//通过项目id查看所有楼栋
	public List<Complex> selectComplexByProjectIdLiu(Integer projectid) {	
		return complexMapper.selectComplexByProjectIdLiu(projectid);
	}
	
	//查询所有楼栋扩展
	public List<ComplexCustom> selectAllComplexCustomLiu(String cnumber) {
		return complexMapper.selectAllComplexCustomLiu(cnumber);
	}
	
	//通过id删除楼栋
	public int deleteComplexById(int id) {
		return complexMapper.deleteByPrimaryKey(id);
	}
	
	//添加楼栋
	public int addComplexConfirmLiu(Complex complex) {
		return complexMapper.insertSelective(complex);
	}
	
	//通过id查询楼栋的扩展类
	public ComplexCustom selectComplexCustomById(int id) {
		return complexMapper.selectComplexCustomById(id);
	}

	public int updateComplexConfirmLiu(Complex complex) {
		return complexMapper.updateByPrimaryKeySelective(complex);
	}

}
